import axios from 'axios';

async function testBackend() {
    console.log('🔍 检查后端服务状态...');

    try {
        const response = await axios.get('http://localhost:5000/api/Supplier/list?PageIndex=1&PageSize=1', {
            timeout: 5000
        });

        console.log('✅ 后端服务运行正常!');
        console.log('📊 响应状态:', response.status);
        console.log('📄 响应数据:', response.data);

    } catch (error) {
        if (error.code === 'ECONNREFUSED') {
            console.log('❌ 后端服务未启动 (连接被拒绝)');
            console.log('💡 请确保后端服务正在运行在端口 5107');
        } else {
            console.log('❌ 连接错误:', error.message);
        }
    }
}

testBackend(); 